package com.witfortos.common.widget;

import androidx.annotation.ColorInt;

import com.choices.divider.Divider;

/**
 * 分割线
 * Created by tan on 2018/1/16.
 */

public class BaseDecoration extends com.choices.divider.DividerItemDecoration {

    private BaseDecoration(@ColorInt int color, int size) {
        setDividerLookup(new AgileDividerLookup(color, size));
    }

    public static BaseDecoration create(@ColorInt int color, int size) {
        return new BaseDecoration(color, size);
    }


    static class AgileDividerLookup implements DividerLookup {
        int color;
        int size;

        AgileDividerLookup(@ColorInt int color, int size) {
            this.color = color;
            this.size = size;
        }


        @Override
        public Divider getVerticalDivider(int position) {


            return new Divider.Builder()
                    .size(size)
                    .color(color)
                    .build();

        }

        @Override
        public Divider getHorizontalDivider(int position) {


            return new Divider.Builder()
                    .size(size)
                    .color(color)
                    .build();

        }
    }
}
